package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import actions.ExecuteQuery;
import javazoom.upload.*;
import java.util.*;
import java.io.*;

public final class SimpleQuery_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

  private static java.util.List _jspx_dependants;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.AnnotationProcessor _jsp_annotationprocessor;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
  }

  public void _jspDestroy() {
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			"ExceptionHandler.jsp", true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("<html>\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      actions.ExecuteQuery queryBean = null;
      synchronized (_jspx_page_context) {
        queryBean = (actions.ExecuteQuery) _jspx_page_context.getAttribute("queryBean", PageContext.PAGE_SCOPE);
        if (queryBean == null){
          queryBean = new actions.ExecuteQuery();
          _jspx_page_context.setAttribute("queryBean", queryBean, PageContext.PAGE_SCOPE);
          out.write("\r\n");
          out.write("<!-- ");
          org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(_jspx_page_context.findAttribute("upBean"), "folderstore", "/tmp/upload", null, null, false);
          out.write(" -->\r\n");
        }
      }
      out.write("\r\n");
      out.write("\r\n");
      javazoom.upload.UploadBean upBean = null;
      synchronized (_jspx_page_context) {
        upBean = (javazoom.upload.UploadBean) _jspx_page_context.getAttribute("upBean", PageContext.PAGE_SCOPE);
        if (upBean == null){
          upBean = new javazoom.upload.UploadBean();
          _jspx_page_context.setAttribute("upBean", upBean, PageContext.PAGE_SCOPE);
          out.write("\r\n");
          out.write("<!-- ");
          org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(_jspx_page_context.findAttribute("upBean"), "folderstore", "/tmp/upload", null, null, false);
          out.write(" -->\r\n");
          out.write("  ");
          org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(_jspx_page_context.findAttribute("upBean"), "folderstore", "C:\\Documents and Settings\\winxp\\workspace\\VadeMecumMultimediaService\\files", null, null, false);
          out.write('\r');
          out.write('\n');
        }
      }
      out.write("\r\n");
      out.write("\r\n");
      org.apache.jasper.runtime.JspRuntimeLibrary.handleSetProperty(_jspx_page_context.findAttribute("upBean"), "parser",
 MultipartFormDataRequest.CFUPARSER );
      out.write('\r');
      out.write('\n');
      org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(_jspx_page_context.findAttribute("upBean"), "parsertmpdir", "/tmp", null, null, false);
      out.write("\r\n");
      out.write("\r\n");
      out.write("<head>\r\n");
      out.write("<title>Query File</title>\r\n");
      out.write("<style TYPE=\"text/css\">\r\n");
      out.write("<!--\r\n");
      out.write(".style1 {\r\n");
      out.write("\tfont-size: 12px;\r\n");
      out.write("\tfont-family: Verdana;\r\n");
      out.write("}\r\n");
      out.write("-->\r\n");
      out.write("</style>\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\r\n");
      out.write("</head>\r\n");
      out.write("<body bgcolor=\"#FFFFFF\" text=\"#000000\">\r\n");
      out.write("\r\n");
      out.write("<ul class=\"style1\">\r\n");

	MultipartFormDataRequest mrequest = new MultipartFormDataRequest(request);
	String todo = null;
	if (mrequest != null) todo = mrequest.getParameter("todo");
	if ( (todo != null) && (todo.equalsIgnoreCase("query")) ) {
		String fileName = mrequest.getParameter("fileName");
		String property = mrequest.getParameter("fileProperty");
		queryBean.setFileName(fileName);
		queryBean.setProperty(property);
		queryBean.execute();
		out.println("<li> Query result: " + queryBean.getQueryResults().toString()+ "<BR> ");
	} else {
        out.println("<li>No query!");
	}

      out.write("\r\n");
      out.write("</ul>\r\n");
      out.write("\r\n");
      out.write("<form method=\"post\" action=\"SimpleQuery.jsp\" enctype=\"multipart/form-data\">\r\n");
      out.write("  <table width=\"60%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\" align=\"center\" class=\"style1\">\r\n");
      out.write("    \r\n");
      out.write("    <tr>\r\n");
      out.write("      <td align=\"left\"><b>Select a name file and its property :</b></td>\r\n");
      out.write("    </tr>\r\n");
      out.write("    <tr>\r\n");
      out.write("      <td align=\"left\">\r\n");
      out.write("        <input type=\"string\" name=\"fileName\" size=\"50\">\r\n");
      out.write("       </td>       \r\n");
      out.write("    </tr>\r\n");
      out.write("    <tr>\r\n");
      out.write("    \t<td align=\"left\">\r\n");
      out.write("        \t<input type=\"string\" name=\"fileProperty\" size=\"50\">\r\n");
      out.write("       \t</td>\t\t\r\n");
      out.write("\t</tr>\t\t\t\r\n");
      out.write("    <tr>\r\n");
      out.write("      <td align=\"left\">\r\n");
      out.write("\t\t<input type=\"hidden\" name=\"todo\" value=\"query\">\r\n");
      out.write("        <input type=\"submit\" name=\"Submit\" value=\"Upload\">\r\n");
      out.write("        <input type=\"reset\" name=\"Reset\" value=\"Cancel\">\r\n");
      out.write("        </td>\r\n");
      out.write("    </tr>\r\n");
      out.write("  </table>\r\n");
      out.write("  <br>\r\n");
      out.write("  <br>\r\n");
      out.write("</form>\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
